import { _decorator, Component, Label, Node } from 'cc';
import AbstractComponent from '../../../base/AbstractComponent';
import { App } from '../../../App';
import { UITransform } from 'cc';
import { view } from 'cc';
import UtilTool from '../../../tools/UtilTool';
import { GameModel3 } from './GameModel3';
const { ccclass, property } = _decorator;

/**认输界面 */
@ccclass('GameMulitExit')
export class GameMulitExit extends Component {
    @property(Node)
    bg : Node = null

    start() {
        this.node.getComponent(UITransform).setContentSize(view.getVisibleSize())
        UtilTool.nodeActive(this.bg, 5)
    }
    
    // 取消
    onBtnCancel() {
        App.Audio.playOneShot("click")
        this.node.destroy()
    }

    // 确定
    onBtnSure() {
        App.Audio.playOneShot("click")
        
        let gameView = App.Model.gameView as GameModel3
        gameView.reqGiveUpMsg(()=>{
            this.node.destroy();
            gameView.gameLogic.exitGame()
            gameView.backToMultiRoom()
        })

        
    }

}
